#ifndef MESSAGEGROUP_H
#define MESSAGEGROUP_H
#include "StompedReality/Base.h"
#include "StompedReality/Core.h"
#include "StompedReality/Core/GameAccess.h"
#include "StompedReality/Core/MessageSystem/ProcessMessage.h"
#include <vector>
namespace StompedReality
{
namespace Core
{
class Message;
typedef DLL_EXPORT std::vector<IDTypeIDTuple> MsgGroupItems;
typedef DLL_EXPORT MsgGroupItems::iterator MsgGroupItemsIter;

/*!
 * \author	Stefan Kazalski
 *
 * \brief	MessageGroup.
 *
 *    Stores a group message recieving objects.
 */
class DLL_EXPORT MessageGroup : public StompedReality::Core::MessageHandler,
  public StompedReality::GameAccess
{
 protected:

  MsgGroupItems _groupItems;
  StompedReality::ID _groupID;

 public:

  //! \brief	Constructor.
  MessageGroup ( );

  //! \brief	Destructor.
  virtual ~MessageGroup( );

  //! \brief	Group id setter.
  void setGroupID( StompedReality::ID id );

  //! \brief	Group id getter.
  StompedReality::ID getGroupID( );

  //! \brief	Adds a group member.
  //! \param	typeID	Items type.
  //! \param	id		Items id.
  void addItem ( TYPE_ID typeID, ID id );

  //! \brief	Groups item list getter.
  MsgGroupItems* getItems( );

  //! \brief	Item Tuple Getter.
  //! \param	idx		Item index.
  //! \return	Type ID tuple.
  IDTypeIDTuple GetItemTupleAt( int idx );

  //! \brief	Returns first tuple of given type.
  //! \param	typeID		Type id.
  //! \return	Type ID tuple.
  IDTypeIDTuple GetFirstTupleOf( StompedReality::TYPE_ID typeID );

  //! \brief	Reads data.
  //!			Reads data from the json value. No changes if parsing fails.
  //! \param	root	The json value.
  //! \return	Success parsing.
  virtual bool ParseJSON ( Json::Value& root ) = 0;

  //! \brief	Writes data.
  //!			Writes data to the json value. No changes if parsing fails.
  //! \param	root	The json value.
  //! \return	Success parsing.
  virtual bool WriteJSON ( Json::Value& root ) = 0;

  //! \brief	Processes a message.
  //!			Sends message to all group members.
  //! \param	msg The message.
  virtual bool ProcessMessage ( StompedReality::Core::Message* msg ) = 0;
};

}
}
#endif // MESSAGEGROUP_H
